$(function() {
    $(".star").raty({
        readOnly:   function() {
            return $(this).attr('data-readOnly');
        },
        number: 5,
        half: true,
        score: function() {
            return $(this).attr('data-score');
        },
        hints: ['失望', '不满', '一般', '满意', '惊喜'],
        target: '#hint',
        targetKeep: true,
        click: function(score, evt) {
            $("#pj_score").val(score);
        }
    })
 });
 function raty(){
     $(".star").raty({
         readOnly:  true,
         number: 5,
         score: function() {
             return $(this).attr('data-score');
         }
     })
 }

 function evaluation(userid,menuid){
     if (userid==''){
         alert("请您先登录再评价");
         return false;
     }
     var pj_score=$("#pj_score").val();
     var pjxx=$("#pjxx").val();
     var url = "/s/uc/shd/evaluation";
     $.post(url,{ cjr: userid,menuid:menuid,satisfaction:pj_score,nr:pjxx, reqtime: (new Date()).getTime() },
         function(data){
             var obj = eval( "(" + data + ")" );
             alert(obj.message);
             $(".star").attr('data-score',obj.score);
             raty();
         }
     );
 }